package com.example.blog.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 *  专门用来映射登录请求的参数
 */
@Data
public class UserLoginDTO {

    @NotBlank(message = "用户名不能为空")
    @Length(min = 6,max = 20,message = "用户名长度需要在[6和20]之间")
//    @Pattern(regexp = "^(?![a-zA-z]+$)(?!\\d+$)(?![!@#$%^&*]+$)[a-zA-Z\\d!@#$%^&*]+$",
//            message = "用户名必须由数字,字母,字符任意两种组成,不能含空格")
    @ApiModelProperty("用户名")
    private String username;

    @Pattern(regexp = "^(?![0-9]+$)(?![a-zA-Z]+$)(?![0-9a-zA-Z]+$)(?![0-9\\W]+$)(?![a-zA-Z\\W]+$)[0-9A-Za-z\\W]{6,18}$",
            message = "密码必须由数字,字母,字符三种组成,且不包括空格")
    @NotBlank(message = "密码不能为空")
    @Length(min = 6,max = 20,message = "密码需要在[6和20]之间")
    @ApiModelProperty("密码")
    private String password;
//
//    @ApiModelProperty("验证码")
//    private String code;
}
